import http from '@/utils/http';

/**
 * 文件上传
 * @param formData
 */
export const fileUpload =  (formData: any) => {
  return http.post('resources/upload', formData, {
    transformRequest: [(params) => {
      return params;
    }],
  });
}



/**
 * 文件上传
 * @param formData
 */
export const uploadImage = (formData: any) => {
  return http.post('resources/uploadImage', formData, {
    transformRequest: [(params) => {
      return params;
    }],
  });
}


export  const  fileDownload=(id: any) => {
  return http.get('resources/file/' +id);
}

export const fetchDownload = async (vectorId: string) => {

  let data = null;
  const res = await fetch('/invest/resources/file/' +vectorId);
  if (!res.ok) {
    throw new Error('Network response was not ok');
  }

  data = await res.json();
  return data;
}